<html><head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<link rel="Start" href="index.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Joueur" rel="Chapter" href="Joueur.html">
<link title="Joueur2" rel="Chapter" href="Joueur2.html">
<link title="Joueur3" rel="Chapter" href="Joueur3.html">
<link title="Joueur4" rel="Chapter" href="Joueur4.html"><title>Joueur2.pose_question</title>
</head>
<body>
<code class="code"><span class="keyword">let</span>&nbsp;<span class="keyword">rec</span>&nbsp;pose_question&nbsp;objet&nbsp;((id_info,contenu):information)=<br>
<span class="keyword">match</span>&nbsp;id_info&nbsp;<span class="keyword">with</span><br>
<span class="keywordsign">|</span>0<span class="keywordsign">-&gt;</span>&nbsp;(0,[|objet<span class="keywordsign">#</span>get_nbjoueurs;objet<span class="keywordsign">#</span>get_id|])<br>
<span class="keywordsign">|</span>1<span class="keywordsign">-&gt;</span>&nbsp;(1,&nbsp;[|contenu.(0)&nbsp;;&nbsp;perso2int&nbsp;(objet<span class="keywordsign">#</span>get_whoswho&nbsp;contenu.(0)&nbsp;)|])<br>
<span class="keywordsign">|</span>2<span class="keywordsign">-&gt;</span>&nbsp;<span class="keyword">if</span>&nbsp;objet<span class="keywordsign">#</span>who_am_i&nbsp;=&nbsp;<span class="constructor">Loup</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">then</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;victime=ref&nbsp;(objet<span class="keywordsign">#</span>get_id)&nbsp;<span class="keyword">and</span>&nbsp;count=ref&nbsp;0&nbsp;<span class="keyword">in</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">while</span>&nbsp;!count&lt;&nbsp;100&nbsp;<span class="keywordsign">&amp;&amp;</span>&nbsp;(objet<span class="keywordsign">#</span>get_whoswho&nbsp;(!victime)=<span class="constructor">Loup</span>&nbsp;<span class="keywordsign">||</span>&nbsp;perso_is_dead&nbsp;(objet<span class="keywordsign">#</span>get_whoswho&nbsp;(!victime))&nbsp;)&nbsp;<span class="keyword">do</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;victime&nbsp;:=&nbsp;<span class="constructor">Random</span>.int&nbsp;objet<span class="keywordsign">#</span>get_nbjoueurs;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incr&nbsp;count<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">done</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(2,[|!victime|])<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">else</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;victime=ref&nbsp;(objet<span class="keywordsign">#</span>get_id)&nbsp;<span class="keyword">and</span>&nbsp;count=ref&nbsp;0&nbsp;<span class="keyword">in</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">while</span>&nbsp;!count&lt;&nbsp;100&nbsp;<span class="keywordsign">&amp;&amp;</span>&nbsp;(perso_is_dead&nbsp;(objet<span class="keywordsign">#</span>get_whoswho&nbsp;(!victime))&nbsp;<span class="keywordsign">||</span>&nbsp;semble_etre_de_mon_cote&nbsp;objet<span class="keywordsign">#</span>who_am_i&nbsp;(objet<span class="keywordsign">#</span>get_whoswho&nbsp;&nbsp;!victime)&nbsp;)&nbsp;<span class="keyword">do</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;victime&nbsp;:=&nbsp;<span class="constructor">Random</span>.int&nbsp;objet<span class="keywordsign">#</span>get_nbjoueurs;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incr&nbsp;count<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">done</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(2,[|!victime|])<br>
<span class="keywordsign">|</span>3<span class="keywordsign">-&gt;</span><span class="keyword">if</span>&nbsp;objet<span class="keywordsign">#</span>who_am_i&nbsp;=&nbsp;<span class="constructor">Loup</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">then</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">let</span>&nbsp;victime=ref&nbsp;(objet<span class="keywordsign">#</span>get_id)&nbsp;<span class="keyword">and</span>&nbsp;count=ref&nbsp;0&nbsp;<span class="keyword">in</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">while</span>&nbsp;!count&lt;&nbsp;100&nbsp;<span class="keywordsign">&amp;&amp;</span>&nbsp;(objet<span class="keywordsign">#</span>get_whoswho&nbsp;(!victime)=<span class="constructor">Loup</span>&nbsp;<span class="keywordsign">||</span>&nbsp;perso_is_dead&nbsp;(objet<span class="keywordsign">#</span>get_whoswho&nbsp;(!victime))&nbsp;)&nbsp;<span class="keyword">do</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;victime&nbsp;:=&nbsp;<span class="constructor">Random</span>.int&nbsp;objet<span class="keywordsign">#</span>get_nbjoueurs;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incr&nbsp;count<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">done</span>;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(2,[|!victime|])<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">else</span>&nbsp;failwith&nbsp;(<span class="constructor">Printf</span>.sprintf&nbsp;<span class="string">"%i&nbsp;dit:&nbsp;ERREUR&nbsp;je&nbsp;ne&nbsp;suis&nbsp;pas&nbsp;un&nbsp;loup&nbsp;garou,&nbsp;une&nbsp;telle&nbsp;erreur&nbsp;n'aurait&nbsp;pas&nbsp;du&nbsp;arriver\n&nbsp;verifier&nbsp;la&nbsp;fonction&nbsp;passe&nbsp;en&nbsp;argument&nbsp;à&nbsp;la&nbsp;procedure&nbsp;de&nbsp;vote&nbsp;"</span>&nbsp;objet<span class="keywordsign">#</span>get_id)<br>
<span class="keywordsign">|</span>4<span class="keywordsign">-&gt;</span><span class="keyword">if</span>&nbsp;objet<span class="keywordsign">#</span>get_whoswho&nbsp;(objet<span class="keywordsign">#</span>get_id)&nbsp;=&nbsp;<span class="constructor">Voyante</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">then</span>&nbsp;&nbsp;(2,[|(<span class="constructor">Random</span>.int&nbsp;objet<span class="keywordsign">#</span>get_nbjoueurs)|])<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="keyword">else</span>&nbsp;failwith&nbsp;(<span class="constructor">Printf</span>.sprintf&nbsp;<span class="string">"%i&nbsp;dit:&nbsp;ERREUR&nbsp;je&nbsp;ne&nbsp;suis&nbsp;pas&nbsp;la&nbsp;voyante,&nbsp;une&nbsp;telle&nbsp;erreur&nbsp;n'aurait&nbsp;pas&nbsp;du&nbsp;arriver\n&nbsp;verifier&nbsp;la&nbsp;fonction&nbsp;passe&nbsp;en&nbsp;argument&nbsp;à&nbsp;la&nbsp;procedure&nbsp;de&nbsp;vote&nbsp;"</span>&nbsp;objet<span class="keywordsign">#</span>get_id)<br>
<span class="keywordsign">|</span>5<span class="keywordsign">-&gt;</span><span class="keyword">if</span>&nbsp;contenu.(0)=objet<span class="keywordsign">#</span>get_id&nbsp;<span class="keyword">then</span>&nbsp;(5,[|0;0;1|])&nbsp;<span class="keyword">else</span>&nbsp;(5,[|<span class="constructor">Random</span>.int&nbsp;2;<span class="constructor">Random</span>.int&nbsp;objet<span class="keywordsign">#</span>get_nbjoueurs;<span class="constructor">Random</span>.int&nbsp;2|])<br>
<span class="keywordsign">|</span>_<span class="keywordsign">-&gt;</span>&nbsp;((-1),[||])</code></body></html>